package com.qdlc.p2p.manage.action.additional;

import com.opensymphony.xwork2.ModelDriven;
import com.qdlc.p2p.biz.service.ReceivingInfoService;
import com.qdlc.p2p.biz.web.action.BaseAction;
import com.qdlc.p2p.dal.common.model.jpa.PageDataList;
import com.qdlc.p2p.dal.model.ReceivingInfoModel;
import org.apache.struts2.convention.annotation.Action;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;

/**
 * Created by honngbinglin on 2016/5/18.
 */
public class ManageReceivingInfoAction extends BaseAction<ReceivingInfoModel> implements ModelDriven<ReceivingInfoModel> {

    private Map<String, Object> data;

    @Resource
    private ReceivingInfoService receivingInfoService;

    /**
     * 收货地址管理页面
     * @return
     * @throws Exception
     */
    @Action(value = "/modules/additional/receivingInfo/receivingInfoManage")
    public String receivingInfoManage() throws Exception {
        return "receivingInfoManage";
    }

    /**
     * 商品列表
     * @return
     * @throws Exception
     */
    @Action(value = "/modules/additional/receivingInfo/receivingInfoList")
    public void commodityList() throws Exception {
        PageDataList<ReceivingInfoModel> dataList = receivingInfoService.list(model);
        data = new HashMap<String, Object>();
        data.put("total", dataList.getPage().getTotal());
        data.put("rows", dataList.getList());
        printJson(getStringOfJpaObj(data));
    }


}
